<?php
class Frontend_QuestionController extends Zendvn_Controller_Action {

	//Mang tham so nhan duoc o moi Action
	protected $_arrParam;

	//Duong dan cua Controller
	protected $_currentController;

	//Duong dan cua Action chinh
	protected $_actionMain;

	//Thong so phan trang
	protected $_paginator = array(
			'itemCountPerPage' => 4 ,
			'pageRange' => 3,
	);
	public $_request_Add ;
	protected $_namespace;
	public function init(){

		$this->_infoUser = new Zendvn_System_Info();
		$checkInfo = $this->_infoUser->createInfo();

		


		//Mang tham so nhan duoc o moi Action
		$this->_arrParam = $this->_request->getParams();

		//Duong dan cua Controller
		$this->_currentController = '/' . $this->_arrParam['module']
		. '/' . $this->_arrParam['controller'];

		//Duong dan cua Action chinh
		$this->_actionMain = '/' . $this->_arrParam['module']
		. '/' . $this->_arrParam['controller']	. '/index';


		$this->_paginator['currentPage'] = $this->_request->getParam('page',1);
		$this->_arrParam['paginator'] = $this->_paginator;

		//Luu cac du lieu filter vao SESSION
		//Dat ten SESSION
		$this->_namespace = $this->_arrParam['module'] . '-' . $this->_arrParam['controller'];
		$ssFilter = new Zend_Session_Namespace($this->_namespace);
		//$ssFilter->unsetAll();
		if(empty($ssFilter->col)){
			$ssFilter->keywords 	= '';
			$ssFilter->col 			= 'u.id';
			$ssFilter->order 		= 'DESC';
			$ssFilter->group_id		= 0;
		}
		$this->_arrParam['ssFilter']['keywords'] 	= $ssFilter->keywords;
		$this->_arrParam['ssFilter']['col'] 		= $ssFilter->col;
		$this->_arrParam['ssFilter']['order'] 		= $ssFilter->order;
		$this->_arrParam['ssFilter']['group_id'] 	= $ssFilter->group_id;

		//Truyen ra view
		$this->view->arrParam = $this->_arrParam;
		$this->view->currentController = $this->_currentController;
		$this->view->actionMain = $this->_actionMain;

		$template_path = TEMPLATE_PATH . "/public/system";
		$this->loadTemplate($template_path,'template.ini','template');

		$this->view->headTitle("Chirldren is the future",true);
	}
	public function indexAction(){
		$model = new Frontend_Model_Question();
		$data = $model->listItem();
		$this->view->data = $data;
	}
}